//目标：使用express-art-template
const express = require('express');
const app = express();
app.listen(3000,()=>{
  console.log('server is running...');
});
let dataArr = {list:[
  {name:"后羿", content:"周日都让我射熄火了", date:"2018-10-10"},
  {name:"鲁班", content:"智商250...", date:"2018-10-10"},
  {name:"程咬金", content:"爱心之斧的正义冲击", date:"2018-10-10"},
  {name:"孙悟空", content:"俺老孙来也", date:"2018-10-10"},
  {name:"妲己", content:"妲己陪你玩哦", date:"2018-10-10"}
]};

const template = require('express-art-template');
const path = require('path');

//配置服务器要使用的模板引擎
//参数1：模板文件的后缀
//参数2：模板引擎对象
app.engine('aaa',template);

app.get('/index',(req,res)=>{
  //render()方法是express提供的，使用任何模板引擎都能使用该方法
  //参数1：模板文件的绝对路径
  //参数2：要显示的数据
  res.render(path.join(__dirname,'./view/index.aaa'),dataArr)
});